package java_thinking.unit_18_IO._18_6;

import java.io.IOException;
import java.io.StringReader;

/**
 * @Desc:   从内存输入-将内存中的String转为char流
 * @author: cww
 * @DateTime: 2019/5/14 17:30
 */

public class MemoryInput {
    public static void main(String[] args) throws IOException {
        StringReader sr = new StringReader(
                BufferedInputFile.read("src/maindemo/java/java_thinking/unit_18_IO/_18_6/MemoryInput.java"));
        int c;
        while ((c = sr.read()) != -1) {
            //read()是以int形式返回下一个字节，因此必须转为char才能正确打印出相关内容
            System.out.print((char) c);
        }

        StringReader sr1 = new StringReader("we are winner \n yes");
        int c1;
        while ((c1 = sr1.read()) != -1) {
            System.out.print((char) c1);
        }
    }
}
